import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

public class Settings
{
	static Properties properties;

	static
	{
		properties = new Properties();
		try
		{
			FileInputStream inputStream = new FileInputStream("properties.xml");
			properties.loadFromXML(inputStream);
			inputStream.close();
		}
		catch (IOException e)
		{

		}

	}

	public static void save() throws IOException
	{
		FileOutputStream outputStream = new FileOutputStream("properties.xml");
		properties.storeToXML(outputStream, "Hello World!", "utf8");
		outputStream.close();
	}

	public static String[] getHighLightedColumns()
	{
		if (properties.containsKey("highlighted columns") == false)
			properties.put("highlighted columns", "Total On Court,Total Plus,Total Minus");

		String value = properties.getProperty("highlighted columns");
		String[] parts = value.split(",");
		for (int i = 0; i < parts.length; i++)
			parts[i] = parts[i].trim();
		return parts;
	}

	public static String[] getHidedColumns()
	{
		if (properties.containsKey("Hided columns") == false)
			properties.put("Hided columns", "Player Name, 1+,2+,3+,4+,1-,2-,3-,4-");

		String value = properties.getProperty("Hided columns");
		String[] parts = value.split(",");
		for (int i = 0; i < parts.length; i++)
			parts[i] = parts[i].trim();
		return parts;
	}
}
